# # 12.1 将仙人球图像中的刺抹除
# import numpy as np
# import cv2
# img = cv2.imread("a1.jpg")
# k = np.ones((3,3),np.uint8)
# cv2.imshow("img",img)
# dst = cv2.erode(img,k)
# cv2.imshow("dst",dst)
# cv2.waitKey()
# cv2.destroyAllWindows()

# # 12.2 将图像加工成”近视眼“的效果
# import numpy as np
# import cv2
# img = cv2.imread("a1.jpg")
# k = np.ones((9,9),np.uint8)
# cv2.imshow("img",img)
# dst = cv2.dilate(img,k)
# cv2.imshow("dst",dst)
# cv2.waitKey()
# cv2.destroyAllWindows()

# 12.3摸除黑种草图像中的针状叶子
# import numpy as np
# import cv2
#
# img = cv2.imread("a1.jpg")
# k = np.ones((5,5),np.uint8)
# cv2.imshow("img",img)
# dst = cv2.erode(img,k)
# dst = cv2.dilate(dst,k)
# cv2.imshow("dst",dst)
# cv2.waitKey()
# cv2.destroyAllWindows()

# 12.3的闭运算
import numpy as np
import cv2

img = cv2.imread("a1.jpg")
k = np.ones((5,5),np.uint8)
cv2.imshow("img",img)
dst = cv2.dilate(img,k)
dst = cv2.erode(dst,k)
cv2.imshow("dst",dst)
cv2.waitKey()
cv2.destroyAllWindows()


